<?php
$url = $this->context->id.'/'.$this->context->action->id;
?>
<style>
    legend {
        width: auto !important;
        border-style: none !important;
    }
    .layui-tab-brief>.layui-tab-title .layui-this a {
        color: #009688 !important;
    }
</style>
<div class="ui-layout-center ui-layout-pane">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse" style="display: block">
                <div class="layui-card-body">
                    <div class="layui-collapse like-layui-collapse" lay-accordion=""
                         style="border:1px dashed #c4c4c4">
                        <div class="layui-colla-item">
                            <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示<i
                                    class="layui-icon layui-colla-icon"></i></h2>
                            <div class="layui-colla-content layui-show">
                                <p>*设置<a href="https://pay.weixin.qq.com" target="view_window">微信支付</a>。具体看各配置描述信息；</p>
                            </div>
                        </div>
                    </div>
                </div>
                <form class="form-horizontal" id="form-config-site-site">
                    <div class="form-group">
                        <label class="col-sm-2 control-label is-required">商户号：</label>
                        <div class="col-sm-9">
                            <input type="text" name="mch_id" value="<?= $model->mch_id ?>"
                                   class="form-control" autocomplete="off" required>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label is-required">v2密钥：</label>
                        <div class="col-sm-9">
                            <input type="text" name="pay_key" value="<?= $model->pay_key ?>" class="form-control"
                                   autocomplete="off" required>
                        </div>
                    </div>
                    <?= \common\widgets\FormInput::widget(['name' => 'file|支付证书', 'extend' => ['exts' => 'pem','is_oss'=>0, 'link' => 'false', 'name' => 'filearr1', 'id' => 'uploadfilebtn1', 'script_after' => '1', 'cat' => 'payment', 'water' => 'true', 'sm' => 2, 'data' => $model->cert_path, 'tips' => '微信支付证书（apiclient_cert.pem），前往微信商家平台下载，文件名一般为apiclient_cert.pem']]) ?>
                    <?= \common\widgets\FormInput::widget(['name' => 'file|支付证书密钥', 'extend' => ['exts' => 'pem','is_oss'=>0, 'link' => 'false', 'name' => 'filearr2', 'id' => 'uploadfilebtn2', 'script_after' => '2', 'cat' => 'payment', 'water' => 'true', 'sm' => 2, 'data' => $model->key_path, 'tips' => '微信支付证书密钥（apiclient_key.pem），前往微信商家平台下载。文件名一般为apiclient_key.pem']]) ?>
                    <input type="hidden" name="cert_path" id="cert_path">
                    <input type="hidden" name="key_path" id="key_path">
                    <div class="form-group text-center mt20">
                        <a href="javascript:;" class="btn btn-success btn-mid b5submit_btn"
                           data-target="form-config-site-site" data-url="<?=\yii\helpers\Url::to(['tran'])?>" data-title="确定提交微信设置">保存</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<?php $this->beginBlock('script'); ?>
    <script>
        function b5submit_btn_before() {
            imgassign("input[name='filearr1[]']", '#cert_path')
            imgassign("input[name='filearr2[]']", '#key_path')
            return true;
        }
    </script>
<?php $this->endBlock(); ?>